import layer_naive
apple=100
apple_num=2
orange=150
orange_num=3
tax=1.1
#layer
mul_apple_layer=layer_naive.MultiLayerNet()
mul_orange_layer=layer_naive.MultiLayerNet()
add_apple_orange_layer=layer_naive.AddLayerNet()
mul_tax_layer=layer_naive.MultiLayerNet()

#forward
apple_price=mul_apple_layer.forward(apple,apple_num)
orange_price=mul_orange_layer.forward(orange,orange_num)
all_price=add_apple_orange_layer.forward(apple_price,orange_price)
price=mul_tax_layer.forward(all_price,tax)

#backward
dprice=1
dall_price,dtax=mul_tax_layer.backward(dprice)
dapple_price,dorange_price=add_apple_orange_layer.backward(dall_price)
dapple,dapple_num=mul_apple_layer.backward(dapple_price)
dorange,dorange_num=mul_orange_layer.backward(dorange_price)


#print
print(price)
print(dapple_num,dapple,dorange,dorange_num,dtax)